package com.pswv2.websocket;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pswv2.bub.bsc.dao.po.MyWallet;
import com.pswv2.util.BackendErrorCode;
import com.pswv2.util.CommonResp;

@Controller
@RequestMapping(value = "webSocketAction", produces = { "text/json;charset=UTF-8" })
public class WebSocketAction {
	private static Class<?> poc = MyWallet.class;
	/**
	 * 检查是否新建webSocket
	 * @param userId
	 * @return
	 */
	@ResponseBody
	@RequestMapping("checkUpWebSocket")
	public String checkUpWebSocket(int vmcNo) {
		boolean bl=WebSocketServer.checkUp(vmcNo);
		if(!bl){
			return CommonResp.buildErrorResp(BackendErrorCode.not_new_web_socket).toJsonString();
		}
		return CommonResp.buildSuccessResp().toJsonString();
	}
	/**
	 * app 发给自己
	 * @return
	 */
	@ResponseBody
	@RequestMapping("messageReminder")
	public String messageReminder(int vmcNo) {
		WebSocketServer.sendMessage1("有人请你帮忙解决困难",vmcNo);
		return CommonResp.buildSuccessResp().toJsonString();
	}
	/**
	 * app 发给其他人
	 * @return
	 */
	@ResponseBody
	@RequestMapping("noMemassHair")
	public String noMemassHair(int vmcNo) {
		WebSocketServer.noMemassHair("有人请你帮忙解决困难",vmcNo);
		return CommonResp.buildSuccessResp().toJsonString();
	}

}